<!DOCTYPE html>
<html>
<head>
    <title>用户登陆</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

    <link rel="stylesheet" href="style/jquery.mobile-1.4.5.css"/>
    <link rel="stylesheet" href="style/jquery.mobile.simpledialog2.css"/>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
    <script type="application/javascript" src="js/jquery.mobile.simpledialog2.js"></script>
    <script type="application/javascript" src="js/config.js"></script>
    <script type="text/javascript">
        if (!window.sessionStorage) {
            alert("暂不支持些浏览器暂访问")
        }
        /**
         * 登陆请求
         */
        function onLogin() {
            var username = $("#textUser").val();
            var pwd = $("#textPwd").val();
            var tempParent = this;
            Custom.request(tempParent,"login/ajaxlogin?username=" + username + "&password=" + pwd,
                    function (data, textStatus) {
                        if (data.name == null) {
                            Custom.alertMessage(tempParent,"登陆失败");
                        } else {
                            sessionStorage.name = data.name;
                            $.mobile.changePage("house.html", { transition: "slide", changeHash: false });
                        }
                    });
        }

    </script>
</head>
<body>

<div data-role="page">

    <div data-role="header">
        <h2>用户登陆</h2>
    </div>
    <!-- /header -->

    <div data-role="content">
        <form>
            <label for="textUser">用户名:</label>
            <input type="text" data-clear-btn="true" id="textUser" placeholder="手机号或者邮箱号" value="yzhao"/>
            <label for="textPwd">密码: </label>
            <input type="password" data-clear-btn="true" id="textPwd" value="1234"/>
            <input type="button" onclick="onLogin()" value="登陆"/>
            <!--<a onclick="onLogin()" class="ui-btn ui-btn-a">登陆</a>-->
            <input type="reset" class="ui-btn ui-btn-a" value="重置"/>
        </form>
    </div>
    <!-- /content -->

</div>
<!-- /page -->

</body>
</html>